<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
</body>
<script src="js/stomp.min.js"></script>
<script>
    //连接地址
    var client = Stomp.client('ws://localhost:15674/ws');
    //设置rabbitmq连接的交换器，一旦收到向交互器发送的消息就弹框
    var on_connect = function(x) {
        //订阅交互器消息
        id = client.subscribe("/exchange/paynotify", function(d) {
            alert(d.body);
        });
    };
    var on_error =  function() {
        console.log('error');
    };
    client.connect('webguest', 'itcast', on_connect, on_error, '/');
</script>
</html>